<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Tool extends CI_Controller {

	function index()
	{
		
	}
	
	function gen_post_code()
	{
		$this->load->model('post_m');
		$posts = $this->post_m->get_many_by();
		foreach ($posts as  $post) {
			$this->post_m->update($post->post_id, array(
				'post_slug' =>create_slug($post->post_title)
				));
			echo $post->post_title."<br>";
		}
	}

	function test_cache()
	{
		$this->load->model('admin_m');
		$posts = $this->admin_m->delete_cache('haha/x');
		// $posts = $this->admin_m->set_cache('haha/x')->get_many_by();
		prd($posts);
	}
	function t_menu()
	{
		// $this->load->model('term_m','term');
		$this->load->model('Category_term_model','category');
		$x = array();
		// $menus = $this->category->get_slug(3);
		$menus = $this->category->get_menu_slug_array(0,'/');
		$this->category->build_link_cache();
		
		prd($menus);
	}

	function pcname()
	{
		echo gethostname().'<br>';
		echo $_SERVER['REMOTE_ADDR'];
	}

	function test_query()
	{
		$this->load->model('admin_m');
		$admins = $this->admin_m->as_sql()->get_all();
		print_r($admins);
		echo "-<br>-";
		print_r($this->db->last_query());
		// as_sql
	}

	function m()
	{

		$this->load->library('email');
		$config['protocol'] = 'smtp';
		$config['smtp_host'] = 'ssl://email-smtp.us-east-1.amazonaws.com';
		$config['smtp_user'] = 'AKIAJNOS5G2KI2PYHD4A';
		$config['smtp_pass'] = 'AtfN03Zed+izNCbFllMyGP1aWtapgSQ6WSx19xcZ7V8e';
		$config['smtp_port'] = 465;
		$config['smtp_timeout'] = 5;


		$this->email->initialize($config);
		$this->email->from('hieupt@sccom.vn', 'Your Name');
		$this->email->to('st.trunghieu@gmail.com'); 
		$this->email->set_newline("\r\n");
		$this->email->subject('Email Test');
		$this->email->message('Testing the email class.');	

		$this->email->send();

		echo $this->email->print_debugger();
	}
	function t()
	{
		echo admin_url().'//';
	}
}
/* End of file welcome.php */
/* Location: ./application/controllers/Welcome.php */